<%@ page language="java" contentType="text/html; charset=Utf-8"
    pageEncoding="Utf-8"%>
<%@ page import="java.sql.*" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="Utf-8">
<title>Insert title here</title>
</head>
<body>
<h1>王凌泷的数据库</h1>
<%
Class.forName("org.mariadb.jdbc.Driver");
Connection connection=DriverManager.getConnection("jdbc:mariadb://localhost:3306/db2","root","wls031028");
Statement stmt=connection.createStatement();
ResultSet rs = stmt. executeQuery("select*from hotel");
out.println("<ul>");
while (rs.next()){
	out.println("<li>酒店名:"+rs.getString("name")+"</li>");
	out.println("<li>位于城市："+rs.getString("city")+"</li>");
}
rs.close();
stmt.close();
connection.close();
%>
</body>
</html>